home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / librw / RWTValMapIterator.z / RWTValMapIterator
Encoding:
Text File  |  1998-10-30  |  7.2 KB  |  199 lines

  1.  
  2.  
  3.  
  4. RRRRWWWWTTTTVVVVaaaallllMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))                                RRRRWWWWTTTTVVVVaaaallllMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))
  5.  
  6.  
  7.  
  8. NNNNaaaammmmeeee
  9.      RWTValMapIterator<K,T,C> - Rogue Wave library class
  10.  
  11. SSSSyyyynnnnooooppppssssiiiissss
  12.               #include<rw/tvmap.h>
  13.  
  14.  
  15.  
  16.               RWTValMap<K,T,C> vm;
  17.           RWTValMapIterator<K,T,C> itr(vm);
  18.  
  19. SSSSttttaaaannnnddddaaaarrrrdddd CCCC++++++++ LLLLiiiibbbbrrrraaaarrrryyyy DDDDeeeeppppeeeennnnddddeeeennnntttt!!!!
  20.      RRRRWWWWTTTTVVVVaaaallllMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr requires the Standard C++ Library.
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27. DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn
  28.      RRRRWWWWTTTTVVVVaaaallllMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr is supplied with TTTToooooooollllssss....hhhh++++++++ 7 to provide an iterator
  29.      interface to RRRRWWWWTTTTVVVVaaaallllMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr that is backward compatable with the
  30.      container iterators provided in TTTToooooooollllssss....hhhh++++++++ 6.x. The order of iteration
  31.      over an RRRRWWWWTTTTVVVVaaaallllMMMMaaaapppp is dependent on the comparator object supplied as
  32.      applied to the key values of the stored associations.  The current item
  33.      referenced by this iterator is undefined after construction or after a
  34.      call to rrrreeeesssseeeetttt(((()))).  The iterator becomes valid after being advanced with
  35.      either a preincrement or ooooppppeeeerrrraaaattttoooorrrr(((()))).  For both ooooppppeeeerrrraaaattttoooorrrr++++++++ and ooooppppeeeerrrraaaattttoooorrrr(((()))),
  36.      iterating past the last element will return a value equivalent to boolean
  37.      ffffaaaallllsssseeee.  Continued increments will return a value equivalent to ffffaaaallllsssseeee
  38.      until rrrreeeesssseeeetttt(((()))) is called.
  39.  
  40. PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee
  41.      None
  42.  
  43. xxxxaaaammmmpppplllleeeessss
  44.               #include<rw/tvmap.h>
  45.  
  46.  
  47.  
  48.               #include<iostream.h>
  49.           #include<rw/cstring.h>
  50.           int main(){
  51.              RWTValMap<RWCString,int,greater<RWCString> > age;
  52.              RWTValMapIterator<RWCString,int,greater<RWCString> > itr(age);
  53.              age.insert("John", 30);
  54.              age.insert("Steve",17);
  55.              age.insert("Mark",24);
  56.           //Insertion is rejected, no duplicates allowed
  57.              age.insert("Steve",24);
  58.              for(;itr();)
  59.                cout << itr.key() << "'s age is " << itr.value() << endl;
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. RRRRWWWWTTTTVVVVaaaallllMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))                                RRRRWWWWTTTTVVVVaaaallllMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))
  71.  
  72.  
  73.  
  74.              return 0;
  75.           }
  76.           Program Output
  77.           Steve's age is 17
  78.           Mark's age is 24
  79.  
  80. PPPPuuuubbbblllliiiicccc CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss
  81.      John's age is 30
  82.  
  83.  
  84.  
  85.               RRRRWWWWTTTTVVVVaaaallllMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr<<<<KKKK,,,,TTTT,,,,CCCC>>>>
  86.  
  87.  
  88.  
  89.               (RWTValMap<K,T,C>&h);
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.      Creates an iterator for the map hhhh.  The iterator begins in an undefined
  97.      state and must be advanced before the first association will be
  98.      accessible.
  99.  
  100. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr OOOOppppeeeerrrraaaattttoooorrrrssss
  101.               RWBoolean
  102.           ooooppppeeeerrrraaaattttoooorrrr(((())))();
  103.  
  104.  
  105.      Advances sssseeeellllffff to the next element.  If the iterator has advanced past the
  106.      last element in the collection, ffffaaaallllsssseeee will be returned.  Otherwise, ttttrrrruuuueeee
  107.      will be returned.
  108.  
  109.               RWBoolean
  110.           ooooppppeeeerrrraaaattttoooorrrr++++++++();
  111.  
  112.  
  113.      Advances sssseeeellllffff to the next element.  If the iterator has been reset or
  114.      just created sssseeeellllffff will now reference the first element.  If, before
  115.      iteration, sssseeeellllffff pointed to the last association in the map, sssseeeellllffff will now
  116.      reference an undefined value and ffffaaaallllsssseeee will be returned.  Otherwise, ttttrrrruuuueeee
  117.      is returned. Note: no postincrement operator is provided.
  118.  
  119. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss
  120.               RWTValMap<K,T,C>*
  121.           ccccoooonnnnttttaaaaiiiinnnneeeerrrr(((()))) const;
  122.  
  123.  
  124.      Returns a pointer to the collection being iterated over.
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. RRRRWWWWTTTTVVVVaaaallllMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))                                RRRRWWWWTTTTVVVVaaaallllMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))
  137.  
  138.  
  139.  
  140.               K
  141.           kkkkeeeeyyyy() const;
  142.  
  143.  
  144.      Returns the key portion of the association currently referenced by sssseeeellllffff.
  145.  
  146.               void
  147.           rrrreeeesssseeeetttt();
  148.           void
  149.           rrrreeeesssseeeetttt(RWTValMap<K,T,C>& h);
  150.  
  151.  
  152.      Resets the iterator so that after being advanced it will reference the
  153.      first element of the collection.  Using rrrreeeesssseeeetttt(((()))) with no argument will
  154.      reset the iterator on the current container.  Supplying a RRRRWWWWTTTTVVVVaaaallllMMMMaaaapppp with
  155.      rrrreeeesssseeeetttt(((()))) will reset the iterator on that container.
  156.  
  157.               T
  158.           vvvvaaaalllluuuueeee();
  159.  
  160.  
  161.      Returns the value portion of the association referenced by sssseeeellllffff.
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.